﻿using KaytechSoftware.Cms.Entities;
using KaytechSoftware.Cms.Services.Interfaces;
using KaytechSoftware.Cms.Services.Interfaces.Entity;

namespace KaytechSoftware.Cms.Services.Dto
{
    public class PhotoAlbumDto : IDto
    {
        public long Id { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public long Order { get; set; }
        public long PageId { get; set; }
        public string PageTitle { get; set; }
        public long? MainPhotoId { get; set; }
        public long? MainPhotoVersion { get; set; }

        public PhotoAlbumDto(PhotoAlbum photoAlbum)
        {
            Id = photoAlbum.Id;
            Title = photoAlbum.Title;
            Description = photoAlbum.Description;
            Order = photoAlbum.Order;
            PageId = photoAlbum.PageId;
            if (photoAlbum.Page != null)
                PageTitle = photoAlbum.Page.Title;

            MainPhotoId = photoAlbum.MainPhotoId;
            if (photoAlbum.MainPhoto != null)
                MainPhotoVersion = photoAlbum.MainPhoto.Version;
        }

        public PhotoAlbumDto()
        {
            
        }
    }
}
